//
//  ZFMapView.m
//  外星球生活圈
//
//  Created by apple on 15/8/17.
//  Copyright (c) 2015年 MR.ZHOU. All rights reserved.
//

#import "ZFMapView.h"
static NSString *reuseId = @"ZFMapView";
@implementation ZFMapView

+ (instancetype)annotationViewMapView:(MKMapView *)mapView withAnnotation:(ZFMapICon *)mapIcon{
    
    ZFMapView *view = (ZFMapView *)[mapView dequeueReusableAnnotationViewWithIdentifier:reuseId];
    if (!view) {
        view = [[ZFMapView alloc] initWithAnnotation:mapIcon reuseIdentifier:reuseId];
    }
    view.mapIcon = mapIcon;
    return view;
}

- (instancetype)initWithAnnotation:(id<MKAnnotation>)annotation reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithAnnotation:annotation reuseIdentifier:reuseId]) {
        self.image = [UIImage imageNamed:@"category_1"];
        self.canShowCallout = YES;
    }
    return self;
}

- (void)setMapIcon:(ZFMapICon *)mapIcon{
    _mapIcon = mapIcon;
    
    // 更改图片

    self.image = [UIImage imageNamed:@"category_1"];
}
@end
